#include "SysTick.h"
#include "LED.h"

uint16_t count = 0;

void Systick_Init(void)
{
    SysTick->CTRL |= SysTick_CTRL_CLKSOURCE;
    SysTick->CTRL |= SysTick_CTRL_TICKINT;

    SysTick->LOAD = 72 * 1000 - 1;
    SysTick->VAL = 0;

    NVIC_SetPriorityGrouping(3);
    NVIC_SetPriority(SysTick_IRQn, 3);
    // NVIC_EnableIRQ(SysTick_IRQn);

    SysTick->CTRL |= SysTick_CTRL_ENABLE;
}

void SysTick_Handler()
{
    count++;
    if (count == 500)
    {
        Hardware_LED_Tg(LED_BLUE);
        count = 0;
    }
}
